package com.bigevent.bigevent.mapper;

import com.bigevent.bigevent.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author yangxudong
 * @description: 用户mapper层
 * @date 2024/2/3 12:52
 */
@Mapper
public interface UserMapper {

    @Insert("insert into user(username,password, create_time, update_time) values(#{username},#{md5String},now(),now())")
    void register(String username, String md5String);

    @Select("select * from user where username = #{username}")
    User findByUsername(String username);

    @Update("update user set email = #{email},nickname = #{nickname},update_time = now() where username = #{username}")
    void updateEmailAndNickName(User queryUser);

    @Update("update user set user_pic = #{userPic}, update_time = now() where username = #{username}")
    void updatePicUrl(User queryUser);

    @Update("update user set password = #{password}, update_time = now() where username = #{username}")
    void updatePwd(User queryUser);
}
